package com.qls.ali.biz.data.controller;

import com.alibaba.fastjson.JSON;
import com.qls.ali.biz.service.fz.Cache;
import com.qls.ali.biz.service.fz.HotelService;
import com.qls.ali.biz.service.mybatis.HtHotelService;
import com.qls.ali.biz.service.mybatis.HtSellRoomService;
import com.qls.ali.biz.service.mybatis.OpOurRateplanService;
import com.qls.ali.model.vo.OpOurRateplanVo;
import com.qls.core.constant.Constant;
import com.qls.core.entity.DtStore;
import com.qls.core.entity.OpOurRateplan;
import com.qls.core.utils.R;
import com.qls.redis.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Administrator
 */
@RestController
public class TestController {

    @Autowired
    private HtHotelService htHotelService;

    @Autowired
    private HtSellRoomService htSellRoomService;

    @Autowired
    private OpOurRateplanService opOurRateplanService;

    @Autowired
    private Cache cache;

    @Autowired
    private HotelService hotelService;

    @Autowired
    private RedisUtil redisUtil;

    @GetMapping("test")
    public R test() {
        //  System.out.println("aaaa");
        List<OpOurRateplan> hotelinfoEntity = opOurRateplanService.list();
        System.out.println(hotelinfoEntity);
        return R.ok();
    }

    @GetMapping("push")
    public R push() {
        List<OpOurRateplanVo> opOurRateplanEntities = opOurRateplanService.getRatePlanPrice(3, 344981L);
        System.out.println(opOurRateplanEntities);
        for (OpOurRateplanVo opOurRateplan : opOurRateplanEntities) {
            System.out.println(opOurRateplan.getChannel());
            System.out.println(opOurRateplan.getId());
            System.out.println(opOurRateplan.getOpOurRateplanPrices());
        }
        return R.ok();
    }

    @PostMapping("pushh")
    public R pushHotel() {
        JSON.toJavaObject((JSON) redisUtil.hashGet(Constant.Redis.STOREID_USER_STORE.getValue(), "8"), DtStore.class);
        /*Map<String,Object> roomCodeMap = new HashMap<>();
        roomCodeMap.put("roomCode",roomCode);
        htLogicRooms.addAll(htSellRoomService.listByMap(roomCodeMap));*/
        return R.ok();
    }
}
